#include<stdio.h>
void main()
{
	char ch = 0;
	int cnt = 0;

	while((ch = getchar()) !='#')
	{
		if((ch == 'A') || (ch == 'a'))
			cnt++;
	}
	printf("pi=%d\n",cnt);
}